# Maintainer:
pkgname=uhd
pkgver=4.6.0.0
pkgrel=3
pkgdesc="USRP Hardware Driver"
url="https://github.com/EttusResearch/uhd"
options="!check" # no tests
arch="all !armhf !s390x" # build failure
license="GPL-3.0-or-later"
makedepends="
	boost-dev
	cmake
	libusb-dev
	py3-mako
	python3-dev
	samurai
	"
subpackages="$pkgname-dev $pkgname-libs $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/EttusResearch/uhd/archive/refs/tags/v$pkgver.tar.gz"

build() {
	case "$CARCH" in
	aarch64)
		local neon=ON
		;;
	*)
		local neon=OFF
		;;
	esac
	cmake -B build-host -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DNEON_SIMD_ENABLE=$neon \
		host
	cmake --build build-host
	sed -i "s|Version:.*|Version: $pkgver|" build-host/uhd.pc
}

package() {
	DESTDIR="$pkgdir" cmake --install build-host
}

sha512sums="
de9bb10e5109bd860a9b2f61841e3ade55fbbc7d8000f385fcdf1c831585c9d25999d159a7da95e3e3f0b74330c1512265994e9aacf00b1b0891f9ba6db58e30  uhd-4.6.0.0.tar.gz
"
